<include file="Public:header" />
<include file="Public:left" />

<style>
    td{text-align:center;}
</style>
<section>
    <div class="page_title">
        <h2 class="fl">文章列表</h2>
        <form action="" >
            <input type="text" class="page_title_input" name="keyword" placeholder="可搜索名称" value="{$keyword?$keyword:'';}">
            关键字
            <select name="is_display">
                <option value="" >全部状态</option>
                <option value="0" <if condition="$is_display eq '0'">selected</if> >未发布</option>
                <option value="1" <if condition="$is_display eq '1'">selected</if> >发布</option>
            </select>
            分类
            <select name="category">
                <option value="" >分类</option>
                <volist name="category_result" id="vo">
                    <option value="{$vo.id}" <if condition="$category eq $vo.id">selected</if> >{$vo.category_name}</option>
                </volist>
            </select>
            <input  class="page_title_submit" type="submit" value="搜索">
        </form>
        <a class="fr" href="{:url('Dynamic/add')}">添加文章</a>
    </div>
    <table class="table">
        <tr>
            <th style="width: 50px;">ID</th>
            <th>图片</th>
            <th>标题</th>
            <th>所属分类</th>
            <th>排序</th>
            <th>部门</th>
            <th>是否要闻</th>
            <th>是否发布</th>
            <th>发布时间</th>
            <th>外链</th>
            <th style="width:150px;">操作</th>
        </tr>
            <volist name="data" id="vo">
            <tr>
                <td>{$vo.id}</td>
                <td><img src="__STATIC__/uploads/{$vo.picture}" style="width: 100px;height:100px;" alt=""></td>
                <td>{$vo.title}</td>
                <td>{$vo.category_name}</td>
                <td>{$vo.order_by}</td>
                <td>{$vo.department}</td>
                <td>
                    <if condition="$vo['is_important'] == 1">要闻
                        <else />非要闻
                    </if>
                </td>
                <td>
                    <if condition="$vo['is_display'] == 1">发布
                        <else />不发布
                    </if>
                </td>
                <td>{$vo.create_time|date="Y-m-d H:i:s",###}</td>
                <td>{$vo.link}</td>
                <td>
                    <a href="{:url('Dynamic/edit',array('id'=>$vo['id']))}" class="inner_btn">编辑</a>
                    <a href="javascript:void(0)" id="{$vo['id']}"  class="inner_btn dynamic_del" >删除</a>
                </td>
            </tr>
        </volist>
    </table>
    {$page}
</section>
     <!--tabStyle-->
<script>
//    删除新闻
    $('.dynamic_del').click(function(){
        var id = $(this).attr('id');
        layer.confirm('删除数据无法恢复，并且会影响用户数据，确定删除？', {
            btn: ['确定', '取消']
        }, function() {
            $.post("{:url('Dynamic/delete')}", {id: id}, function (result) {

                if (result.code == '0') {
                    layer.alert(result.msg);
                } else {
                    layer.alert(result.msg, {
                                btn: ['确定']
                            },
                            function (index, item) {
                                //layer.close(index);
                                location.reload();
                            });
                }
            });
        });
    });
</script>
 </div>
</section>
</body>
</html>
